from web.model.base_model import *


class Questionnaire(BaseModel):
    __abstract__ = False
    id = Column(Integer, primary_key=True, autoincrement=True, comment="问卷编号")
    questionTitle = Column(String(32), nullable=False, comment="问卷标题")
    userId = Column(String(64), nullable=False, comment="用户编号")
    status = Column(Integer, nullable=False, comment="问卷状态")


class Question(BaseModel):
    __abstract__ = False
    id = Column(Integer, primary_key=True, autoincrement=True, comment="问题编号")
    order = Column(Integer, nullable=False, comment="问题序号")
    questionName = Column(String(256), nullable=False, comment="问题的详细描述")
    questionnaireId = Column(Integer, comment="问卷编号")
    type = Column(Integer, nullable=False, comment="问题类型")
    required = Column(Integer, nullable=False, comment="问题是否必答")


class Options(BaseModel):
    __abstract__ = False
    id = Column(Integer, primary_key=True, autoincrement=True, comment="选项编号")
    optionName = Column(String(64), nullable=False, comment="选项内容")
    questionId = Column(Integer, comment="问题编号")
    count = Column(Integer, nullable=False, comment="选项统计")


class Completed(BaseModel):
    __abstract__ = False
    id = Column(Integer, primary_key=True, autoincrement=True, comment="记录编号")
    userId = Column(String(32), nullable=False, comment="用户编号")
    questionnaireId = Column(Integer, nullable=False, comment="问卷编号")


class Completion(BaseModel):
    __abstract__ = False
    id = Column(Integer, primary_key=True, autoincrement=True, comment="记录编号")
    userId = Column(String(32), nullable=False, comment="用户编号")
    questionnaireId = Column(Integer, nullable=False, comment="问卷编号")
    questionId = Column(Integer, nullable=False, comment="问题编号")
    context = Column(String(512), nullable=False, comment="填空题内容")


